Skip to content

Conversation

@matthijskooijman
Copy link
Collaborator

Just a trivial comment typo and a fairly small cleanup I noticed while chasing a baud rate bug (which turned out to be in my own code, but well ;-p).

I've tested these changes with all four serial ports on a Mega2560 and the single port on a Uno, which worked as expected.

Before, HardwareSerial1+.cpp were a copy of HardwareSerial1.cpp with all
0's replaced by the corresponding number. This would mean that e.g.
the Serial1 object would use the UBRRL register instead of UBRR1L when
it was defined, or the USART_RX_vect instead of USART1_RX_vect.

In practice, this would neve actually cause problems, since:
 - No avr chip currently has both the non-numbered registers as well as
   numbered registers.
 - HardwareSerial.h would only define HAVE_HWSERIALx when the
   corresponding numbered register is defined (except for
   HAVE_HWSERIAL0, which is also defined when the unnumbered registers
   are present).

Furthermore, before both the UARTx_xx_vect and USART_x_xx_vect was used.
Looking at the include files, only UART1_xx_vect is actually used (by
iom161.h), the others use USARTx_xx_vect. For this reason,
HardwareSerial1.cpp keeps the preprocessor conditional to select either
UART or USART and the other files use USART unconditionally.

While we're here, also fix the compiler error message when no valid ISR
name was found (it previously said "for the first UART" in all cases).
@cmaglie cmaglie merged commit b26db20 into arduino:ide-1.5.x May 23, 2014
@cmaglie
Copy link
Member

cmaglie commented May 23, 2014

Tested also on Yun, works fine.

@matthijskooijman
Copy link
Collaborator Author

Thanks!

@matthijskooijman matthijskooijman deleted the ide-1.5.x-hwserial-cleanup branch June 12, 2015 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants